<template>
	<view class="index">
		<uv-navbar placeholder autoBack bgColor="#CA1C1D">
			<template v-slot:left>
				<view class="left_slot">
					<image src="@/static/images/back.png"></image>
				</view>
			</template>
			<template v-slot:center>
				<view class="nav_title">门店主页</view>
			</template>
		</uv-navbar>
		<component :is="currentComponent" :id="props_id" />
		<Tabbar @change="change" />
	</view>
</template>

<script setup>
	import Tabbar from "@/components/shop/Tabbar.vue";
	import Introduce from "@/components/shop/Introduce.vue";
	import Promotion from "@/components/shop/Promotion.vue";
	import SmallStore from "@/components/shop/SmallStore.vue";
	import {
		onLoad
	} from "@dcloudio/uni-app";
	import {
		ref,
		shallowRef
	} from "vue";

	const currentComponent = shallowRef(Promotion);
	const change = index => {
		if (index == 0) {
			currentComponent.value = Introduce;
		}
		if (index == 1) {
			currentComponent.value = Promotion;
		}
		if (index == 2) {
			currentComponent.value = SmallStore;
		}
	};
	const props_id = ref("");
	onLoad(options => props_id.value = options.id);
</script>

<style scoped lang="scss">
	.index {
		height: calc(100vh - var(--window-top) - var(--window-bottom));
		background: #f5f5f5;
		overflow: hidden;

		.left_slot {
			image {
				width: 43rpx;
				height: 36rpx;
			}
		}

		.nav_title {
			color: #F5F5F5;
			font-size: 36rpx;
		}

		:deep() {
			.scroll_view {
				height: calc(100vh - var(--window-top) - var(--window-bottom) - #{$navBarHeight} - #{$tabbarHeight});
				background: #FFFFFF;
			}

			.tabbar_icon {
				width: 36rpx;
				height: 36rpx;
			}
		}
	}
</style>